home *** CD-ROM | disk | FTP | other *** search
/ Nothing but Tetris / Nothing but Tetris.iso / amiga / workbench_tris / tetris.h < prev    next >
C/C++ Source or Header  |  1992-11-19  |  2KB  |  80 lines

  1. /*
  2. Copyright (c) 1992, Trevor Smigiel.  All rights reserved.
  3.  
  4. (I hope Commodore doesn't mind that I borrowed their copyright notice.)
  5.  
  6. The source and executable code of this program may only be distributed in free
  7. electronic form, via bulletin board or as part of a fully non-commercial and
  8. freely redistributable diskette.  Both the source and executable code (including
  9. comments) must be included, without modification, in any copy.  This example may
  10. not be published in printed form or distributed with any commercial product.
  11.  
  12. This program is provided "as-is" and is subject to change; no warranties are
  13. made.  All use is at your own risk.  No liability or responsibility is assumed.
  14.  
  15. */
  16.  
  17. #define NBITMAPS 20
  18.  
  19. #define PFWIDTH  10
  20. #define PFHEIGHT 20
  21.  
  22. #define TWIDTH  (BSize + PWIDTH + BSize)
  23. #define THEIGHT (4 * YSize + PHEIGHT + BSize)
  24.  
  25. #define UPDATE_TIME      50000
  26. #define UPDATE_SECONDS   (1000000 / UPDATE_TIME - 1)
  27.  
  28. #define TETRIS_PORT "Tetris_Port"
  29.  
  30. #define COMMAND_IGNORE   0x0000
  31. #define COMMAND_LEFT     0x0001
  32. #define COMMAND_RIGHT    0x0002
  33. #define COMMAND_DOWN     0x0003
  34. #define COMMAND_ROTATE   0x0004
  35.  
  36. #define GOAL_CLEAR_LINES 0x0001
  37. #define GOAL_TIME_LIMIT  0x0002
  38. #define GOAL_ENDURANCE   0x0004
  39.  
  40. #define TETF_GAMEOVER  0x0001
  41. #define TETF_NEXTLEVEL 0x0002
  42. #define TETF_OUTOFTIME 0x0004
  43. #define TETF_OUTOFROOM 0x0008
  44.  
  45. struct TPiece {
  46.     WORD which, x, y, bx, by;
  47. };
  48.  
  49. struct TLevel {
  50.     WORD goal;     /* 1 for lines, 2 for time limit, 4 for endurance*/
  51.     WORD lines;    /* number of lines to get */
  52.     WORD time;     /* time to do it in, or time to last */
  53.     WORD line_up;
  54.     UWORD board[PFHEIGHT + 1];
  55. };
  56.  
  57. struct TBoard { 
  58.     struct TLevel level;
  59.     WORD flags;
  60.     struct RastPort *rastport;
  61.     struct BitMap bitmap;
  62.     Point board_off;
  63.     Point score_off;
  64.     Point line_off;
  65.     Point time_off;
  66.     Point next_off;
  67.     WORD seed[3];
  68.     struct TPiece piece;
  69.     WORD next_which;
  70.     WORD drop_up;
  71.     WORD next_line_up, next_drop_up;
  72.     WORD drop, next_drop;
  73.     WORD lines;
  74.     WORD next_sec, time;
  75.     WORD clevel;
  76.     LONG points;
  77.     WORD pieces[7];
  78. };
  79.  
  80.